//
//  MainNavigationController.m
//  微博
//
//  Created by 杨佩璋 on 15/6/24.
//  Copyright (c) 2015年 杨佩璋. All rights reserved.
//

#import "MainNavigationController.h"
#import "WillBeShownCollectionViewController.h"

@interface MainNavigationController ()

@end

@implementation MainNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

//+ (void)initialize
//{
//    // 设置所有的item 样式。
//    UIBarButtonItem *item = [UIBarButtonItem appearance];
//
//    NSMutableDictionary *textDic = [NSMutableDictionary dictionary];
//    textDic[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
//    textDic[NSFontAttributeName] = [UIFont systemFontOfSize:15];
//    [item setTitleTextAttributes:textDic forState:UIControlStateNormal];
//
//    NSMutableDictionary *distextDic = [NSMutableDictionary dictionary];
//    distextDic[NSForegroundColorAttributeName] = [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.7];
//    distextDic[NSFontAttributeName] = [UIFont systemFontOfSize:13];
//    [item setTitleTextAttributes:distextDic forState:UIControlStateDisabled];
//
//}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setBackgroundImage:[UIImage imageNamed:@"iconfont-jiantouzuo(1).png"] forState:UIControlStateNormal];
        [button setBackgroundImage:[UIImage imageNamed:@"iconfont-jiantouzuo.png"] forState:UIControlStateHighlighted];
        button.width = 30;
        button.height = 30;
        [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithCustomView:button];
        viewController.navigationItem.leftBarButtonItem = leftButton;
        viewController.hidesBottomBarWhenPushed = YES;
        if ([viewController isKindOfClass:[WillBeShownCollectionViewController class]]) {
            viewController.hidesBottomBarWhenPushed = NO;
            
        }
        
        
        [leftButton release];
    }
    [super pushViewController:viewController animated:animated];
    
}

- (void)back
{
    [self popViewControllerAnimated:YES];
}

@end
